home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 008 / egamsc.arc / EGA.DOC < prev    next >
Encoding:
Text File  |  1986-02-25  |  52.3 KB  |  1,650 lines

  1.  
  2.                                                         DATE:   02/25/86
  3.                                                         SYSTEM: KC-TPEGA
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.               Graphics for the IBM's Enhance Graphic Adapter (EGA)
  20.  
  21.  
  22.                               Version 02/25/86
  23.  
  24.  
  25.                            for Microsoft C 3.00+
  26.  
  27.                                    and
  28.  
  29.                             Turbo Pascal 3.01A+
  30.  
  31.  
  32.                                                         DATE:   02/03/86
  33.                                                         SYSTEM: KC-TPEGA
  34.  
  35.  
  36.  
  37.                                  IMPORTANT NOTICE
  38.  
  39.  
  40.         The Enhanced Graphic Adapter (EGA) graphic routines for Microsoft
  41.         3.0 and Turbo Pascal 3.01A was written and is maintained by:
  42.  
  43.                                Kent Cedola
  44.                                2015 Meadow Lake Court
  45.                                Norfolk, Virginia  23518
  46.                                1-(804)-857-0613
  47.  
  48.         Users of this software are encouraged to copy and distribute the
  49.         graphics library and demonstrations programs which are a part of
  50.         this package for non-commericial purposes.
  51.  
  52.         No fee or other charges may be made in the distribution of these
  53.         programs without the written permission from Kent Cedola.
  54.  
  55.         Any program written with this graphic library may be sold, as
  56.         long as the source code for the graphic library in not included.
  57.         If you wish to include the graphic library with the product,
  58.         please contact me for more information and written permission.
  59.  
  60.         The date of release will be used in instead of a version.  When
  61.         requesting information, please included the date (version) of the
  62.         copy that you have and the amount of EGA memory.  Write the above
  63.         for the current release of the graphic library.
  64.  
  65.         If you are satified with the EGA support for Turbo Pascal you are
  66.         asked to send a donation of $20.00 dollars.  All registered users
  67.         will be informed of any major improvements and/or programs
  68.         developments.
  69.  
  70.                                 FREE COPY OF TPEGA
  71.  
  72.         If you send a diskette with a SASE, I will send you the current
  73.         copy of the library and programs for FREE! (360k or 1.2meg disk)
  74.  
  75.  
  76.                                                         DATE:   02/03/86
  77.                                                         SYSTEM: KC-TPEGA
  78.  
  79.  
  80.  
  81.                                       GENERAL
  82.  
  83.  
  84.         This graphic software was written to provide the general public
  85.         a means for writing graphic program for the EGA without any run-
  86.         time fee!  The software is also design to give the programmer
  87.         the most flexibility, so most graphic routines can be changed or
  88.         deleted (saving space) from the final product.
  89.  
  90.  
  91.         If you have some application that required some special high-speed
  92.         graphic routine, let me know and I'll see what I can do.  But most
  93.         routines that are not provided can be built around the standard
  94.         graphic primitives. Graphic primitives (any routine with a prefix
  95.         of GP) are low level graphic routine that are (mostly) supported
  96.         over various graphic adapters (in the future).
  97.  
  98.  
  99.         Those with the standard EGA (only 64k of memory) may have some
  100.         problems with some of the graphic primitives as I have a 128k+
  101.         EGA.  I highly recommend adding extra memory to your EGA if
  102.         you plan to do alot of graphic programming.
  103.  
  104.  
  105.             The future for EGA graphic library                 Release
  106.  
  107.                1.  Support Microsoft's mouse.                   APR86
  108.                2.  Support for AT&T's ICB (digitizer).          APR86
  109.                3.  Support image processing routines            APR86
  110.                4.  Support virtual workspace & workareas        APR86
  111.                5.  Support 320x200x16 mode
  112.                6.  Support high-speed sprite routines.
  113.                7.  Support graphic segments to build objects.
  114.                8.  Support 3D graphic and CAD routines.
  115.                9.  Support for PC-EYE from Chorus Data Systems.
  116.               10.  Support for AT&T's VDA.
  117.  
  118.  
  119.                                                         DATE:   02/03/86
  120.                                                         SYSTEM: KC-TPEGA
  121.  
  122.  
  123.                            Questions & Answers
  124.  
  125.  
  126.         Q.  Do you maintain the current version of your graphic library
  127.             on a BBS?  If so, which one.
  128.         A.  Yes, the PC-CONNECTION (804) 481-1824, will always contain
  129.             the current version of ALL of my EGA software.  But user
  130.             validation is required (+money, 10 or 20 a year).  The BBS
  131.             contains two nodes and 60megs online.  Any disk with SASE
  132.             sent to me will be return with ALL my EGA software (FREE).
  133.  
  134.         Q.  Where is the assembler source code?
  135.         A.  I am holding assembler source code to try to maintain an
  136.             EGA graphic standard and to make it easier to change it
  137.             without effecting others with 'old' assembler code.  Very
  138.             little of the code is for the EGA, most is just standard
  139.             graphic code that could be used with any graphic adapter.
  140.             I will release all source code sometime in the future. I
  141.             don't know when.
  142.  
  143.         Q.  Do you know that some of your comments do not match the
  144.             code below it? (from Steve)
  145.         A.  Yes, the documentation manual will always contain the
  146.             correct information.  Don't worry about the headers.
  147.             I'm mostly worried about the code working.
  148.  
  149.         Q.  Will you re-code your routines for other graphic adapters
  150.             to form a public domain standard for graphic primitives?
  151.         A.  Yes, I am currently re-coding for the AT&T's Image Capture
  152.             Board (ICB) and adding image processing routines.
  153.  
  154.         Q.  How about BASIC support?
  155.         A.  Buy Turbo Pascal or Microsoft C 3.0+.
  156.             (C is better for writing large graphic programs).
  157.  
  158.  
  159.                                                         DATE:   02/03/86
  160.                                                         SYSTEM: KC-TPEGA
  161.  
  162.  
  163.                                 SPECIAL NOTICE
  164.  
  165.  
  166.         While trying to get as many graphic routines as possible in this
  167.         release I had to cut corners on the GPSHADE, GPFILL and GPFLOOD
  168.         graphic primitives.  The GPFILL should be used for simple objects
  169.         to be filled in and GPFLOOD for complex objects. Currently, GPFILL
  170.         calls GPFLOOD to do the fill, this will change in the future as I
  171.         will write a version of GPFILL that will execute two or three times
  172.         faster than GPFLOOD (GPFILL = Simple objects only).  GPSHADING has
  173.         a restriction for dimensions of 1,2,4 or 8 or both width and height.
  174.         Other dimensions can be used, but funny fills may happen (will be
  175.         fixed later).  The GPFLOOD routine is fast, and will fill in any
  176.         area no matter how complex (more complex more stack space), but I
  177.         will re-write it for higher speeds.
  178.  
  179.         Both the GPBOX and GPBALL primitives only do solid colors and not
  180.         shades.  Both use special EGA full byte fill modes and are fast.
  181.         BPBOX and GPBALL do NOT set the clipping flag. (Later)
  182.  
  183.         These primitives do work, but they can be better.  I will improve
  184.         the flexibility and speed of these routines in the future.
  185.  
  186.         The following routines miss this release (are in the documentation)
  187.         will be included in a future release.
  188.  
  189.                         GPSCROLL
  190.                         GPPOLY
  191.  
  192.  
  193.                                                         DATE:   02/03/86
  194.                                                         SYSTEM: KC-TPEGA
  195.  
  196.  
  197.                          SPECIAL NOTICE TO C USERS
  198.  
  199.  
  200.         So much code, so little time to write it!  All of the Turbo Pascal
  201.         routines have been converted to Microsoft C and mostly tested (see
  202.         programs kc_pal.c, demo.c and popup.c).  Please examine the source
  203.         code!  It does contain information that is not in the documentation
  204.         (e.g., gotoxy, gprintf, gpmovgtm and gpmovgtm).
  205.  
  206.         The C release is not as clean as I would like because of the BIG
  207.         improvements in the 01APR86 release (C only!).  And I did not want
  208.         to hold the graphic library until then because most graphic routines
  209.         will not change.  The the 01APR86 release will contain the concept
  210.         of virtual workspaces (memory array) and real workareas (graphic
  211.         display).  I need it for Image Processing Software that I am coding
  212.         in C, but will be very powerful to most other programmers.  For
  213.         example:
  214.  
  215.                 1. Automatic swapping of workspaces when not being used.
  216.                    (workspaces contain fonts, icons, parts of the screen)
  217.  
  218.                 2. Each pixel in a workspace may be 1,2,4,8 or 16 bits.
  219.                    (defined when workspace created).
  220.  
  221.                 3. Automatic clipping of images to/from display.
  222.  
  223.                 4. Automatic zooming/shrinking (if requested) when moving
  224.                    images (or letter and icons) to/from display.
  225.  
  226.                 5. Windowing of a workspace in a workarea? (MAYBE)
  227.  
  228.  
  229.                                                         DATE:   02/03/86
  230.                                                         SYSTEM: KC-TPEGA
  231.  
  232.  
  233.                         List of Graphic Functions
  234.  
  235.  
  236.          Graphics Routines               Description
  237.         ----------------------------    ---------------------------------
  238.          GPPARMS;                        Setup graphic adapter parameters
  239.          GPINIT;                         Initialize graphic display
  240.          GPTERM;                         Terminate graphic display
  241.  
  242.          GPCOLOR(b);                     Set current color
  243.          GPMERGE(b);                     Set current merge mode
  244.          GPSTYLE(array);                 Set pattern for drawing lines
  245.          GPSHADE(array);                 Set pattern for shading areas
  246.          GPRDCLR;                        Return the current color
  247.  
  248.          GPPAL(p,v);                     Set a palette register
  249.          GPCPAL(p,v);                    Set a palette register using RGB
  250.          GPLDPAL(array);                 Load all palette registers
  251.          GPRDPAL(p);                     Read current palette setting
  252.  
  253.          GPPLOT(X,Y);                    Plot a point at X,Y (sets new CP)
  254.          GPRDDOT(X,Y)                    Read pixel at coordinates (X,Y)
  255.          GPMOVE(X,Y);                    Set current graphic position (CP)
  256.          GPLINE(X,Y);                    Draw a line from (CP) to X,Y
  257.          GPPOLY(array,N);                Draw a N number of lines
  258.          GPRECT(X,Y);                    Draw a rectangle between CP and (X,Y)
  259.          GPCIR(R);                       Draw a circle at CP with R radius
  260.  
  261.          GPWTROW(Array,N);               Write a row of pixels
  262.          GPWTCOL(Array,N);               Write a column of pixels
  263.          GPRDROW(Array,N);               Read a row of pixels
  264.          GPRDCOL(Array,N);               Read a column of pixels
  265.  
  266.          GPBOX(X,Y);                     Draws a solid box with color/shading
  267.          GPBAL(R);                       Draws a solid circle with color/shading
  268.  
  269.          GPSCROLL(Dir,I,N);              Scroll current viewport
  270.  
  271.          GPVIEWPORT(X1,Y1,X2,Y2);        Set current viewport
  272.          GPWINDOW(X1,Y1,X2,Y2);          Set current window
  273.          GPCLIP1(X,Y);                   Clip point in current window
  274.          GPCLIP2(X1,Y1,X2,Y2);           Clip line in current window
  275.          GPSCALE(X,Y);                   Scale from world to device
  276.  
  277.          GPFILL(Border);                 Simple object fill, color/shading
  278.          GPFLOOD(Border);                Complex object fill, color/shading
  279.  
  280.  
  281.                                                         DATE:   02/03/86
  282.                                                         SYSTEM: KC-TPEGA
  283.  
  284.  
  285.                         List of Global Variables
  286.  
  287.  
  288.          Global Variable                 Description
  289.         ----------------------------    ---------------------------------
  290.          GDTYPE:        Integer;         3 = CG, 4 = Mono, 5 = Color
  291.          GDOTHER:                        Internal Use Only
  292.          GDMEMORY:      Integer;         Amount of memory, 64 -> 256
  293.          GDMAXCOL:      Integer;         Maximum column (639 for EGA)
  294.          GDMAXROW:      Integer;         Maximum row (199/349 for EGA)
  295.          GDMAXPAL:      Integer;         Maximum palettes (4/16 for EGA)
  296.          GDMAXCLR:      Integer;         Maximum colors (63 for EGA)
  297.  
  298.          GDCOLOR:       Integer;         Current color for drawing
  299.          GDMERGE:                        Internal Use Only
  300.          GDSTYLE:                        Internal Use Only
  301.          GDSHADE:                        Internal Use Only
  302.          GDSHADE1:                       Internal Use Only
  303.          GDASPC1:       Integer;         Aspect for circles (3 for EGA)
  304.          GDASPC2:       Integer;         Aspect for circles (4 for EGA)
  305.          GDCUR_X:       Integer;         Current X coordinate
  306.          GDCUR_Y:       Integer;         Current Y coordinate
  307.  
  308.          GDGSEG:                         Internal Use Only
  309.          GDGSADR:                        Internal Use Only
  310.  
  311.          GDWD_X1:       Integer;         Window coordinate (low)
  312.          GDWD_X2:       Integer;         Window coordinate (high)
  313.          GDWD_X3:       Integer;         Window coordinate (delta+1)
  314.          GDWD_Y1:       Integer;         Window coordinate (low)
  315.          GDWD_Y2:       Integer;         Window coordinate (high)
  316.          GDWD_Y3:       Integer;         Window coordinate (delta+1)
  317.  
  318.          GDVW_X1:       Integer;         Viewport coordinate (low)
  319.          GDVW_X2:       Integer;         Viewport coordinate (high)
  320.          GDVW_X3:       Integer;         Viewport coordinate (delta+1)
  321.          GDVW_Y1:       Integer;         Viewport coordinate (low)
  322.          GDVW_Y2:       Integer;         Viewport coordinate (high)
  323.          GDVW_Y3:       Integer;         Viewport coordinate (delta+1)
  324.  
  325.          GDC_FLG:       Integer;         Last plot clipping status
  326.          GDS_FLG:       Integer;         Color/Shade or Color/Style flag
  327.          GDW_FLG:       Integer;         Enable/Disable World coordinates
  328.  
  329.          GDCURX1:       Integer;         World current X coordinate
  330.          GDCURY1:       Integer;         World current Y coordinate
  331.  
  332.  
  333.                                                         DATE:   02/03/86
  334.                                                         SYSTEM: KC-TPEGA
  335.  
  336.  
  337.  
  338.         NAME:
  339.  
  340.                 GPPARMS -- Setup current graphic adapter parameters
  341.  
  342.         SYNOPSIS:
  343.  
  344.                 P: procedure GPPARMS;
  345.  
  346.                 C: void GPPARMS();
  347.  
  348.         DESCRIPTION:
  349.  
  350.                 This procedure will initialize various global variables
  351.             on the status of the current graphic adapter.  If only needs
  352.             to be executed once in the life of a program.
  353.  
  354.         RETURNS:
  355.  
  356.             GDTYPE = 0, no ega, monochrome adapter (text mode) { maybe }
  357.                    = 1, no ega, old color graphic adapter (CG) { maybe }
  358.                    = 2, EGA with old color graphic monitor (320x200x16)
  359.                    = 3, EGA with old color graphic monitor (640x200x16)
  360.                    = 4, EGA with monochrome monitor (640x350x4)
  361.                    = 5, EGA with new Enhanced Color Display (640x350x16)
  362.                    = 6, ?
  363.  
  364.         CAUTIONS:
  365.  
  366.             This procedure MUST be performed before any other primitive.
  367.                            ----
  368.         EXAMPLE:
  369.  
  370.             P: GPPARMS;                    { Determine the type of Adapter }
  371.  
  372.                if GDTYPE <> 4 and GDTYPE <> 5 then   { 4 = mono, 5 = color }
  373.                  begin
  374.                  writeln('Must have IBM Enhanced Graphic Display!');
  375.                  halt(1);
  376.                  end;
  377.  
  378.             C: GPPARMS();
  379.  
  380.                if (GDTYPE != 5)
  381.                  {
  382.                  fprintf(stderr,'Must have EGA color display!\n');
  383.                  exit(1);
  384.                  };
  385.  
  386.  
  387.                                                         DATE:   02/03/86
  388.                                                         SYSTEM: KC-TPEGA
  389.  
  390.  
  391.  
  392.         NAME:
  393.  
  394.                 GPINIT -- Initialize the Enhanced Graphic Adapter
  395.  
  396.         SYNOPSIS:
  397.  
  398.                 P: PROCEDURE GPINIT;
  399.  
  400.                 C: GPINIT();
  401.  
  402.         DESCRIPTION:
  403.  
  404.                 This procedure will place the EGA in color or mono
  405.             graphic mode depending on hardware connected to the EGA.
  406.             This routine can be repeated to reset graphic state. If
  407.             you are using the standard color monitor with the EGA,
  408.             will setup in 640x200 (16 colors) mode, else 640x350.
  409.  
  410.         CAUTIONS:
  411.  
  412.                 The procedure 'GPPARMS' must be used to determine if
  413.             an EGA is available. The EGA must be placed in graphic mode
  414.             before executing the other graphic routines (not including
  415.             'GPPARMS').
  416.  
  417.         EXAMPLE:
  418.  
  419.             P: GPPARMS;                 { Determine the type of Adapter }
  420.  
  421.                if GDTYPE <> 4 and GDTYPE <> 5 then
  422.                  begin
  423.                  write('Must have IBM Enhanced Graphic Display!');
  424.                  halt;
  425.                  end
  426.                else
  427.                  begin
  428.                  GPInit;                 { Initialize the EGA           }
  429.                  end;
  430.  
  431.             C: GPPARMS();
  432.  
  433.                if (GDTYPE != 4)
  434.                  {
  435.                  fprintf(stderr,'Must have EGA monochrome display!\n');
  436.                  exit(1);
  437.                  }
  438.                else
  439.                  {
  440.                  GPINIT();
  441.                  };
  442.  
  443.         SEE ALSO:
  444.  
  445.             GPPARMS and GPTERM.
  446.  
  447.  
  448.                                                         DATE:   02/03/86
  449.                                                         SYSTEM: KC-TPEGA
  450.  
  451.  
  452.  
  453.         NAME:
  454.  
  455.                 GPTERM -- Terminate graphic mode and return to text
  456.  
  457.         SYNOPSIS:
  458.  
  459.                 P: procedure GPTERM;
  460.  
  461.                 C: void GPTERM;
  462.  
  463.         DESCRIPTION:
  464.  
  465.                 This procedure will return the EGA back to text mode.
  466.                 Mode 3 for color EGA and mode 7 for monochrome monitors.
  467.  
  468.         CAUTIONS:
  469.  
  470.                 Should not be performed on a non EGA computer.
  471.  
  472.         EXAMPLES:
  473.  
  474.             P: GPTERM;
  475.  
  476.             C: GPTERM();
  477.  
  478.         SEE ALSO:
  479.  
  480.             GPPARMS and GPINIT.
  481.  
  482.  
  483.                                                         DATE:   02/03/86
  484.                                                         SYSTEM: KC-TPEGA
  485.  
  486.  
  487.  
  488.         NAME:
  489.  
  490.                 GPCOLOR -- Set the current color
  491.  
  492.         SYNOPSIS:
  493.  
  494.                 P: procedure GPCOLOR(Value: Integer);
  495.  
  496.                 C: void GPCOLOR(Value)
  497.                      int Value;
  498.  
  499.         DESCRIPTION:
  500.  
  501.                 Set the color to be used by the other ploting routines
  502.             (GPPLOT, GPLINE, GPRECT, etc...).  The primitive GPRDCLR can
  503.             can be used to read the current color. The global GDMAXPAL will
  504.             contain the highest color value allowed.   Setting the color
  505.             will set the style/shading flag to zero, this will cause all
  506.             drawing and filling primitives to use the current color and
  507.             not the current style/shading.  Use the Turbo Pascal function
  508.             TEXTCOLOR for text coloring.
  509.  
  510.         EXAMPLE:
  511.  
  512.             P: GPCOLOR(Green);             { Set color to Green     }
  513.                GPMOVE(50,50);              { Draw a green rectangle }
  514.                GPRECT(100,100);
  515.  
  516.             C: color = GPRDCLR;            /* Save the current color */
  517.  
  518.                GPCOLOR(Red);               /* Define a new color     */
  519.  
  520.                GPMOVE(X1,Y1);              /* Draw a red line        */
  521.                GPLINE(X2,Y2);
  522.  
  523.                GPCOLOR(color);             /* Restore color          */
  524.  
  525.         SEE ALSO:
  526.  
  527.             GPRDCLR, GPSTYLE, GPSHADE.
  528.  
  529.  
  530.                                                         DATE:   02/03/86
  531.                                                         SYSTEM: KC-TPEGA
  532.  
  533.  
  534.  
  535.         NAME:
  536.  
  537.                 GPMERGE -- Set the placement of graphic data
  538.  
  539.         SYNOPSIS:
  540.  
  541.                 P: procedure GPMERGE(Value: Integer);
  542.  
  543.                 C: void GPMERGE(Value)
  544.                      int Value;
  545.  
  546.                                Merge modes, 0 - Store (default)
  547.                                             1 - AND
  548.                                             2 - OR
  549.                                             3 - XOR
  550.  
  551.         DESCRIPTION:
  552.  
  553.                 Specify the method which data is placed in the graphic
  554.             memory.  The various merge modes are performed with hardware
  555.             on the EGA.  Almost all graphic routines will be effected by
  556.             setting the merge value, but not all.
  557.  
  558.         CAUTIONS:
  559.  
  560.                 Setting non-zero merge mode can slow down some graphic
  561.            primitives. (e.g., GPFLOOD).
  562.  
  563.         EXAMPLE:
  564.  
  565.             P: GPMERGE(3);                    { Set merge mode to XOR }
  566.                GPCOLOR(Green);                { Set color to Green    }
  567.                GPMOVE(50,50);                 { XOR green box         }
  568.                GPBOX(100,100);
  569.                GPMERGE(0);                    { Return merge mode to default }
  570.  
  571.         SEE ALSO:
  572.  
  573.             GPFILL and GPFLOOD.
  574.  
  575.  
  576.                                                         DATE:   02/03/86
  577.                                                         SYSTEM: KC-TPEGA
  578.  
  579.  
  580.  
  581.         NAME:
  582.  
  583.                 GPSTYLE -- Set the current line style
  584.  
  585.         SYNOPSIS:
  586.  
  587.                 P: procedure GPSTYLE(var Style);
  588.  
  589.                 C: void GPSTYLE(Style)
  590.                      unsigned char Style[];
  591.  
  592.         DESCRIPTION:
  593.  
  594.                 Set the line style for the line drawing primitives.  The
  595.             parameter is an array of color bytes with the first byte con-
  596.             taining the length.  The style/shading flag will be set to
  597.             non-zero to flag the line routines to use the current line style
  598.             and not the current color setting.
  599.  
  600.         EXAMPLE:
  601.  
  602.             C: unsigned char Style[] =     /* Set line style to GGBB  */
  603.                  {4,Green,Green,Blue,Blue};
  604.  
  605.                GPSTYLE(Style);             /* Define the line style   */
  606.  
  607.                GPMOVE(X1,Y1);
  608.                GPLINE(X2,Y2);              /* Draw line using style   */
  609.  
  610.                GPCOLOR(color);             /* Set color               */
  611.  
  612.                GPLINE(X3,Y3);              /* Draw green line         */
  613.  
  614.                GPS_FLG := -1;              /* Goback to style setting */
  615.  
  616.                GPLINE(X4,Y4);              /* Draw line using style   */
  617.  
  618.         SEE ALSO:
  619.  
  620.             GPCOLOR.
  621.  
  622.  
  623.                                                         DATE:   02/03/86
  624.                                                         SYSTEM: KC-TPEGA
  625.  
  626.  
  627.  
  628.         NAME:
  629.  
  630.                 GPSHADE -- Set the current fill/flood shading
  631.  
  632.         SYNOPSIS:
  633.  
  634.                 P: procedure GPSHADE(var Style);
  635.  
  636.                 C: void GPSHADE(Style)
  637.                      unsigned char Style[];
  638.  
  639.         DESCRIPTION:
  640.  
  641.                 Set the shading matrix for fill/flooding primitives.  The
  642.             parameter is an array of color bytes with the first byte con-
  643.             taining the width and the second containing the height.  The
  644.             style/shading flag (GDS_FLG) will be set to a non-zero value.
  645.  
  646.         CAUTIONS:
  647.  
  648.             Although any dimension from 1 to 255 can be used, the current
  649.             version of GPFILL and GPFLOOD only works correctly with shade
  650.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  651.             restriction will be removed in the future.
  652.  
  653.         EXAMPLE:
  654.  
  655.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  656.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  657.  
  658.                GPSHADE(Shade);             /* Define the shading      */
  659.  
  660.                GPMOVE(X1,Y1);
  661.                GPFLOOD(color);             /* Flood area with border
  662.                                               defined by color        */
  663.  
  664.         SEE ALSO:
  665.  
  666.             GPCOLOR, GPSTYLE, GPFILL and GPFLOOD.
  667.  
  668.  
  669.                                                         DATE:   02/03/86
  670.                                                         SYSTEM: KC-TPEGA
  671.  
  672.  
  673.  
  674.         NAME:
  675.  
  676.                 GPRDCLR -- Read the current color
  677.  
  678.         SYNOPSIS:
  679.  
  680.                 P: function GPRDCLR: Integer;
  681.  
  682.                 C: int GPRDCLR();
  683.  
  684.         DESCRIPTION:
  685.  
  686.                 Return the current color setting.  Use to save the current
  687.             color setting.
  688.  
  689.         RETURN:
  690.  
  691.                 The current color setting.
  692.  
  693.         EXAMPLE:
  694.  
  695.             C: color = GPRDCLR;            /* Save the current color */
  696.  
  697.                GPCOLOR(Red);               /* Define a red line      */
  698.  
  699.                GPMOVE(X1,Y1);
  700.                GPLINE(X2,Y2);              /* Draw a red line        */
  701.  
  702.                GPCOLOR(color);             /* Restore color          */
  703.  
  704.         SEE ALSO:
  705.  
  706.             GPCOLOR.
  707.  
  708.  
  709.                                                         DATE:   02/03/86
  710.                                                         SYSTEM: KC-TPEGA
  711.  
  712.  
  713.  
  714.         NAME:
  715.  
  716.                 GPPAL -- Set a palette register
  717.  
  718.         SYNOPSIS:
  719.  
  720.                 P: procedure GPPAL(Palette, Color: Integer);
  721.  
  722.                 C: void GPPAL(Palette, Color)
  723.                      int Palette, Color;
  724.  
  725.         DESCRIPTION:
  726.  
  727.                 Set a palette to a given color value.  The maximum range
  728.             of the palette variable is contained in GDMAXPAL. The max
  729.             range of the color variable in contained in GDMAXCLR. These
  730.             two global variables are set by the routine 'GPPARMS'.   If
  731.             -1 is the palette value then the border is set to the given
  732.             color.
  733.  
  734.         CAUTIONS:
  735.  
  736.                 Setting the border color is not recommended for the EGA.
  737.  
  738.         EXAMPLE:
  739.  
  740.             P: GPPAL(5,20);                { Set palette 5 to color 20  }
  741.  
  742.         SEE ALSO:
  743.  
  744.             GPCPAL and GPRDPAL.
  745.  
  746.                                                         DATE:   02/03/86
  747.                                                         SYSTEM: KC-TPEGA
  748.  
  749.  
  750.  
  751.         NAME:
  752.  
  753.                 GPCPAL -- Set a palette register using R,G,B
  754.  
  755.         SYNOPSIS:
  756.  
  757.                 P: procedure GPCPAL(Palette, R, G, B: Integer);
  758.  
  759.                 C: void GPCPAL(Palette, R, G, B)
  760.                      int Palette, R, G, B;
  761.  
  762.         DESCRIPTION:
  763.  
  764.                 Set a palette to a given color using the RGB values.
  765.             The max value of each primary color can be determine by the
  766.             (cube root of (GDMAXCLR+1) - 1).  If -1 is the palette value
  767.             then the border is set to the given color.
  768.  
  769.         CAUTIONS:
  770.  
  771.                 Setting the border color is not recommended for the EGA.
  772.  
  773.         EXAMPLE:
  774.  
  775.             P: GPCPAL(5,2,1,0);            { Set palette 5 to RGB(2,1,0)}
  776.  
  777.         SEE ALSO:
  778.  
  779.             GPPAL and GPRDPAL.
  780.  
  781.                                                         DATE:   02/03/86
  782.                                                         SYSTEM: KC-TPEGA
  783.  
  784.  
  785.  
  786.         NAME:
  787.  
  788.                 GPLDPAL -- Set all the palette registers
  789.  
  790.         SYNOPSIS:
  791.  
  792.                 P: procedure GPLDPAL(var Palettes : Bytes);
  793.  
  794.                 P: void GPLDPAL(Palettes)
  795.                      unsigned char Palettes[];
  796.  
  797.         DESCRIPTION:
  798.  
  799.                 Load all the palette registers from a given array.  The
  800.             number of palettes can be determine by GDMAXPAL + 2.  The
  801.             border color is located in GDMAXPAL + 2.
  802.  
  803.         CAUTIONS:
  804.  
  805.                 Setting the border color is not recommended for the EGA.
  806.  
  807.         EXAMPLE:
  808.  
  809.             P: pals: array [0..16] of byte; { pals[0] > pals[15] colors }
  810.                                             { pals[16] border color     }
  811.  
  812.                for i := 0 to 15 do          { Reset to default colors   }
  813.                  begin
  814.                  if i < 8 then
  815.                    pals[i] := i
  816.                  else
  817.                    pals[i] := 48 + i;
  818.  
  819.                pals[16] := 0;               { Keep border Black         }
  820.  
  821.                GPLDPAL(pals);               { Set palettes and border   }
  822.  
  823.  
  824.                                                         DATE:   02/03/86
  825.                                                         SYSTEM: KC-TPEGA
  826.  
  827.  
  828.  
  829.         NAME:
  830.  
  831.                 GPRDPAL -- Set a palette register
  832.  
  833.         SYNOPSIS:
  834.  
  835.                 P: function GPRDPAL(Palette: Integer): Integer;
  836.  
  837.                 C: int GPRDPAL(Palette)
  838.                      int Palette;
  839.  
  840.         DESCRIPTION:
  841.  
  842.                 Read the setting of the specified palette register.  If
  843.             an EGA save area has not be defined then this function will
  844.             return -1 instead of a palette color.  Use the program
  845.             'KCSETPAL' to define a save area.
  846.  
  847.         RETURN:
  848.  
  849.                 Palette color or -1 if can be found. (run KCSETPAL).
  850.  
  851.         EXAMPLE:
  852.  
  853.             C: current_color = GPRDPAL(5)  /* Read palette 5  */
  854.  
  855.                if (current_color == -1)    /* Recover on null */
  856.                  current_color = 5;
  857.  
  858.         SEE ALSO:
  859.  
  860.             GPPAL.
  861.  
  862.  
  863.                                                         DATE:   02/03/86
  864.                                                         SYSTEM: KC-TPEGA
  865.  
  866.  
  867.  
  868.         NAME:
  869.  
  870.                 GPPLOT -- Plot a pixel at the given corrdinate
  871.  
  872.         SYNOPSIS:
  873.  
  874.                 P: procedure GPPLOT(x,y: Integer);
  875.  
  876.                 C: void GPPLOT(x,y)
  877.                      int x,y;
  878.  
  879.         DESCRIPTION:
  880.  
  881.                 Plot a point at the given coordinates using the current
  882.             color and merge values.  The upper left corner is (0,0) on
  883.             the graphic screen.  The specifed (X,Y) coordinate becomes
  884.             the new current position (CP).  Automatic clipping is
  885.             preformed.
  886.  
  887.         RETURN:
  888.  
  889.             GDC_FLG = 0 if point is in the current viewport.
  890.                       2 if point out of current viewport (not plotted)
  891.  
  892.         EXAMPLE:
  893.  
  894.             P: GPCOLOR(Green);          { Set color to Green            }
  895.                GPPLOT(5,5);             { Plot a Green pixels at (5,5)  }
  896.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  897.  
  898.         SEE ALSO:
  899.  
  900.             GPCOLOR, GPMERGE and GPMOVE.
  901.  
  902.  
  903.                                                         DATE:   02/03/86
  904.                                                         SYSTEM: KC-TPEGA
  905.  
  906.  
  907.  
  908.         NAME:
  909.  
  910.                 GPRDDOT --  --  endthe pixel at the given corrdinate
  911.  
  912.         SYNOPSIS:
  913.  
  914.                 P: function GPRDDOT(x,y: Integer): Integer;
  915.  
  916.                 C: int GPRDDOT(x,y)
  917.                      int x,y;
  918.  
  919.         DESCRIPTION:
  920.  
  921.                 1,ge the pixel at the given coordinates.
  922.  
  923.         CAUTIONS:
  924.  
  925.                 The global variable GDMEMORY is used to determine the
  926.             number of planes to read (two for 64k, and four 128k+)
  927.  
  928.         EXAMPLE:
  929.  
  930.             P: color: Integer;
  931.  
  932.                color := GPRDDOT(5,4)    { Read color at (5,4)           }
  933.  
  934.         SEE ALSO:
  935.  
  936.             GPPARMS.
  937.  
  938.  
  939.                                                         DATE:   02/03/86
  940.                                                         SYSTEM: KC-TPEGA
  941.  
  942.  
  943.  
  944.         NAME:
  945.  
  946.                 GPMOVE -- Move graphic cursor to new position
  947.  
  948.         SYNOPSIS:
  949.  
  950.                 P: procedure GPMOVE(x,y: Integer);
  951.  
  952.                 C: void GPMOVE(x,y)
  953.                      int x,y;
  954.  
  955.         DESCRIPTION:
  956.  
  957.                 Set the graphic cursor to the specified position to be
  958.             the new current position (CP).
  959.  
  960.         EXAMPLE:
  961.  
  962.             P: GPCOLOR(Green);          { Set color to Green            }
  963.                GPMOVE(5,5);             { Set CP to (5,5)               }
  964.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  965.  
  966.         SEE ALSO:
  967.  
  968.             GPPLOT and GPLINE.
  969.  
  970.  
  971.                                                         DATE:   02/03/86
  972.                                                         SYSTEM: KC-TPEGA
  973.  
  974.  
  975.  
  976.         NAME:
  977.  
  978.                 GPLINE -- Draw a line from CP to (X,Y)
  979.  
  980.         SYNOPSIS:
  981.  
  982.                 P: procedure GPLINE(x,y: Integer);
  983.  
  984.                 C: void GPLINE(x,y)
  985.                      int x,y;
  986.  
  987.         DESCRIPTION:
  988.  
  989.                 Draw a line from the current position (CP) to the given
  990.             coordinate using the current merge, color or line style values.
  991.             Automatic line clipping is performed in the current viewport.
  992.  
  993.         RETURN:
  994.  
  995.             GDC_FLG = 0 if line is in the current viewport.
  996.                       1 if line was clipped, but still plotted (part of)
  997.                       2 if line out of current viewport (not plotted)
  998.  
  999.         EXAMPLE:
  1000.  
  1001.             P: GPCOLOR(Green);          { Set color to Green            }
  1002.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1003.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  1004.  
  1005.         SEE ALSO:
  1006.  
  1007.             GPCOLOR, GPMERGE, GPSTYLE and GPMOVE.
  1008.  
  1009.  
  1010.                                                         DATE:   02/03/86
  1011.                                                         SYSTEM: KC-TPEGA
  1012.  
  1013.  
  1014.  
  1015.         NAME:
  1016.  
  1017.                 GPPOLY -- Connect an array of points
  1018.  
  1019.         SYNOPSIS:
  1020.  
  1021.                 P: procedure GPPOLY(var points; N: Integer);
  1022.  
  1023.                 C: void GPLINE(points,n)
  1024.                      int points[]
  1025.                      int n;
  1026.  
  1027.         DESCRIPTION:
  1028.  
  1029.                 Starting from the CP, connect each point with a line.
  1030.  
  1031.         EXAMPLE:
  1032.  
  1033.             P: GPCOLOR(Green);          { Set color to Green            }
  1034.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1035.                GPPOLY(car,50);          { Draw a car                    }
  1036.  
  1037.         SEE ALSO:
  1038.  
  1039.             GPLINE.
  1040.  
  1041.  
  1042.                                                         DATE:   02/03/86
  1043.                                                         SYSTEM: KC-TPEGA
  1044.  
  1045.  
  1046.  
  1047.         NAME:
  1048.  
  1049.                 GPRECT -- Draw a rectangle
  1050.  
  1051.         SYNOPSIS:
  1052.  
  1053.                 P: procedure GPRECT(x,y: Integer);
  1054.  
  1055.                 C: void GPRECT(x,y)
  1056.                      int x,y;
  1057.  
  1058.         DESCRIPTION:
  1059.  
  1060.                 Draws a rectangle with CP and given x,y coordinates.
  1061.             The X,Y coordinates becomes the new CP.
  1062.  
  1063.         EXAMPLE:
  1064.  
  1065.             P: GPCOLOR(Green);          { Set color to Green            }
  1066.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1067.                GPRECT(10,10);           { Draw a rectangle              }
  1068.  
  1069.         SEE ALSO:
  1070.  
  1071.             CPCOLOR, GPMOVE and GPLINE.
  1072.  
  1073.  
  1074.                                                         DATE:   02/03/86
  1075.                                                         SYSTEM: KC-TPEGA
  1076.  
  1077.  
  1078.  
  1079.         NAME:
  1080.  
  1081.                 GPCIR -- Draw a circle around the CP
  1082.  
  1083.         SYNOPSIS:
  1084.  
  1085.                 P: procedure GPCIR(radius: Integer);
  1086.  
  1087.                 C: void GPCIR(radius)
  1088.                      int radius;
  1089.  
  1090.         DESCRIPTION:
  1091.  
  1092.                 Starting from the CP, draw a circle with the given radius
  1093.             around it clipping in the current viewport.
  1094.  
  1095.         RETURN:
  1096.  
  1097.             GDC_FLG = 0 if circle is in the current viewport.
  1098.                       1 if circle was clipped, but still plotted (part of)
  1099.                       2 if circle out of current viewport (not plotted)
  1100.  
  1101.         CAUTIONS:
  1102.  
  1103.             The current line style can not be used only the color value.
  1104.  
  1105.         EXAMPLE:
  1106.  
  1107.             P: GPCOLOR(Green);          { Set color to Green            }
  1108.                GPMOVE(100,100);         { Set CP to (5,5)               }
  1109.                GPCIR(50);               { Draw a circle                 }
  1110.  
  1111.         SEE ALSO:
  1112.  
  1113.             GPMOVE.
  1114.  
  1115.  
  1116.                                                         DATE:   02/03/86
  1117.                                                         SYSTEM: KC-TPEGA
  1118.  
  1119.  
  1120.  
  1121.         NAME:
  1122.  
  1123.                 GPWTROW -- Write a row of pixels
  1124.  
  1125.         SYNOPSIS:
  1126.  
  1127.                 P: procedure GPWTROW(var Pixels: Byte; N: Integer);
  1128.  
  1129.                 C: void GPWTROW(Pixels,N)
  1130.                      unsigned char Pixels[];
  1131.                      int N;
  1132.  
  1133.         DESCRIPTION:
  1134.  
  1135.                 Write a row of pixels from the current position (CP), N
  1136.             pixels wide using the specifed byte array of colors.
  1137.  
  1138.         CAUTIONS:
  1139.  
  1140.                 If the row of pixels leave the edge of the screen, the
  1141.             rest will appear on the other side. (Can be a plus).
  1142.  
  1143.         EXAMPLE:
  1144.  
  1145.             P: Pixels: array [0.63] of byte;
  1146.  
  1147.                GPMOVE(5,5);
  1148.                GPWTROW(Pixels,64);
  1149.  
  1150.         SEE ALSO:
  1151.  
  1152.             GPMOVE, and GPWTCOL.
  1153.  
  1154.  
  1155.                                                         DATE:   02/03/86
  1156.                                                         SYSTEM: KC-TPEGA
  1157.  
  1158.  
  1159.  
  1160.         NAME:
  1161.  
  1162.                 GPWTCOL -- Write a column of pixels
  1163.  
  1164.         SYNOPSIS:
  1165.  
  1166.                 P: procedure GPWTCOL(var Pixels: Byte; N: Integer);
  1167.  
  1168.                 C: void GPWTCOL(Pixels,N)
  1169.                      unsigned char Pixels[];
  1170.                      int N;
  1171.  
  1172.         DESCRIPTION:
  1173.  
  1174.                 Write a column of pixels from the current position (CP),
  1175.             N pixels high using the specifed byte array of colors.
  1176.  
  1177.         CAUTIONS:
  1178.  
  1179.                 If the column of pixels leave the edge of the screen,
  1180.             the rest will appear on the other side. (Can be a plus).
  1181.  
  1182.         EXAMPLE:
  1183.  
  1184.             P: Pixels: array [0.63] of byte;
  1185.  
  1186.                GPMOVE(5,5);
  1187.                GPWTROW(Pixels,64);
  1188.  
  1189.         SEE ALSO:
  1190.  
  1191.             GPMOVE, and GPWTROW.
  1192.  
  1193.  
  1194.                                                         DATE:   02/03/86
  1195.                                                         SYSTEM: KC-TPEGA
  1196.  
  1197.  
  1198.  
  1199.         NAME:
  1200.  
  1201.                 GPBOX -- Fills in specified box with current color
  1202.  
  1203.         SYNOPSIS:
  1204.  
  1205.                 P: procedure GPBOX(x,y: Integer);
  1206.  
  1207.                 C: void GPBOX(x,y)
  1208.                      int x,y;
  1209.  
  1210.         DESCRIPTION:
  1211.  
  1212.                 Fills the specified area (box shaped) using the current
  1213.             color and merge value.  Normally useendto clear the screen or
  1214.             reverse an area using merge XOR setting.  The CP and the
  1215.             specified X,Y coordinates are usee as the corners of the box.
  1216.  
  1217.         RETURN:
  1218.  
  1219.             GDC_FLG = 0 if box is in the current viewport.
  1220.                       1 if box was clipped, but still plotted (part of)
  1221.                       2 if box out of current viewport (not plotted)
  1222.  
  1223.         EXAMPLE:
  1224.  
  1225.             P: GPCOLOR(Black);
  1226.                GPMOVE(0,0);
  1227.                GPBOX(GDMAXCOL,GDMAXROW); { Clear Screen }
  1228.  
  1229.             C: GPCOLOR(GDMAXCLR)            /* Load 0x0F to reverse bits */
  1230.                GPMERGE(3);                  /* Set merge mode to XOR     */
  1231.                GPMOVE(50,50);
  1232.                GPBOX(100,100);              /* Reverse bits in this box  */
  1233.  
  1234.         SEE ALSO:
  1235.  
  1236.             GPCOLOR, GPMERGE.
  1237.  
  1238.  
  1239.                                                         DATE:   02/03/86
  1240.                                                         SYSTEM: KC-TPEGA
  1241.  
  1242.  
  1243.  
  1244.         NAME:
  1245.  
  1246.                 GPBALL -- Fills in specified circle with color/shade
  1247.  
  1248.         SYNOPSIS:
  1249.  
  1250.                 P: procedure GPBALL(Radius: Integer);
  1251.  
  1252.                 C: void GPBALL(Radius)
  1253.                      int Radius;
  1254.  
  1255.         DESCRIPTION:
  1256.  
  1257.                 Fills the specified area (ball shaped) using the current
  1258.             color and merge value.
  1259.  
  1260.         RETURN:
  1261.  
  1262.             GDC_FLG = 0 if ball is in the current viewport.
  1263.                       1 if ball was clipped, but still plotted (part of)
  1264.                       2 if ball out of current viewport (not plotted)
  1265.  
  1266.         EXAMPLE:
  1267.  
  1268.             P: GPCOLOR(Blue);
  1269.                GPMOVE(100,100)
  1270.                GPBALL(50);
  1271.  
  1272.         SEE ALSO:
  1273.  
  1274.             GPCIR, GPCOLOR and GPSHADE.
  1275.  
  1276.  
  1277.                                                         DATE:   02/03/86
  1278.                                                         SYSTEM: KC-TPEGA
  1279.  
  1280.  
  1281.  
  1282.         NAME:
  1283.  
  1284.                 GPSCROLL -- Scroll the current viewport
  1285.  
  1286.         SYNOPSIS:
  1287.  
  1288.                 P: procedure GPSCROLL(Dir, N: Integer);
  1289.  
  1290.                 C: void GPSCROLL(Dir, N)
  1291.                      int  Dir, N;
  1292.  
  1293.         DESCRIPTION:
  1294.  
  1295.                 Scroll the viewport in the specified direction by N
  1296.             lines.  The viewport to be scrolled must be a byte boundary.
  1297.             (x coordinate only).  The direction code is defined as:
  1298.  
  1299.                             0    4   12
  1300.                             1    5   13
  1301.                             3    7   15
  1302.  
  1303.         EXAMPLE:
  1304.  
  1305.             P: GPVIEWPORT(48,50,95,100);
  1306.  
  1307.                GPSCROLL(4,1);   { Scroll the viewport up by one line }
  1308.  
  1309.         SEE ALSO:
  1310.  
  1311.             GPVIEWPORT.
  1312.  
  1313.  
  1314.                                                         DATE:   02/03/86
  1315.                                                         SYSTEM: KC-TPEGA
  1316.  
  1317.  
  1318.  
  1319.         NAME:
  1320.  
  1321.                 GPVIEWPORT -- Specified an area to plot graphic commands
  1322.  
  1323.         SYNOPSIS:
  1324.  
  1325.                 P: procedure GPVIEWPORT(x1,y1,x2,y2: Integer);
  1326.  
  1327.                 C: void GPVIEWPORT(x1,y1,x2,y2)
  1328.                      int x1,y1; /* lower left corner of viewport  */
  1329.                      int x2,y2; /* upper right corner of viewport */
  1330.  
  1331.         DESCRIPTION:
  1332.  
  1333.                 Specify an area on the screen to perform graphic function.
  1334.             The viewport parameters are in Graphic Device Units (GDU). The
  1335.             IBM's Enhance Graphic Adapter is 640x350 GDUs.  The 'GPINIT'
  1336.             function will perform viewport(0,0,639,349).  This function is
  1337.             simular to the Turbo's GraphWindow or BASIC's Viewport.  The
  1338.             basic graphic primitives are clipped using the current viewport.
  1339.  
  1340.         EXAMPLE:
  1341.  
  1342.             GPVIEWPORT(50,50,600,300); { Define viewport }
  1343.                                                  |
  1344.                 .-----------------------.        |
  1345.                 |(0,0)                  |        |
  1346.                 |   .---------------.   |        |
  1347.                 |   |(50,50)        |   |        |
  1348.                 |   |               <------------+
  1349.                 |   |               |   |
  1350.                 |   |      (600,300)|   |
  1351.                 |   `---------------'   |<--- Default Viewport
  1352.                 |              (639,349)|
  1353.                 `-----------------------'
  1354.  
  1355.         SEE ALSO:
  1356.  
  1357.             GPPLOT, GPLINE, GPCIR and GPWINDOW.
  1358.  
  1359.  
  1360.                                                         DATE:   02/03/86
  1361.                                                         SYSTEM: KC-TPEGA
  1362.  
  1363.  
  1364.  
  1365.         NAME:
  1366.  
  1367.                 GPWINDOW -- specified a set coordinates
  1368.  
  1369.         SYNOPSIS:
  1370.  
  1371.                 procedure GPWindow(x1,y1,x2,y2: Integer);
  1372.  
  1373.                 int  x1,y1;     lower left corner of window
  1374.                 int  x2,y2;     upper right corner of window
  1375.  
  1376.         DESCRIPTION:
  1377.  
  1378.                 Specify a new set of coordinates for the current viewport.
  1379.             The coordinates are signed integers (-32768 <--> +32767).  It
  1380.             is simular to the BASIC's Window function.  The graphic
  1381.             primitives GPSCALE, GPCLIP1 and GPCLIP2 can be used for scaling
  1382.             and clipping using the current window.  See the file WORLD.P
  1383.             for function that support the world coordinate system.
  1384.  
  1385.         RETURNS:
  1386.  
  1387.             None.
  1388.  
  1389.         CAUTIONS:
  1390.  
  1391.                 If the viewport and window coordinates are different then
  1392.             an extra scaling process is perform on graphic functions.  No
  1393.             checks are performed on input parameters.
  1394.  
  1395.         EXAMPLE:
  1396.  
  1397.             GPViewport(50,50,600,300);    { Define viewport }
  1398.             GPWindow(-100,-100,100,100); { Define a new set of corrdinates }
  1399.                                                  |
  1400.                 .-----------------------.        |
  1401.                 |(0,0)                  |        |
  1402.                 |   .---------------.   |        |
  1403.                 |   |(-100,-100)    |   |        |
  1404.                 |   |               <------------+
  1405.                 |   |               |   |
  1406.                 |   |      (100,100)|   |
  1407.                 |   `---------------'   |<--- Default Viewport
  1408.                 |              (639,349)|
  1409.                 `-----------------------'
  1410.  
  1411.         SEE ALSO:
  1412.  
  1413.             GPVIEWPORT, and GPSCALE.
  1414.  
  1415.                                                         DATE:   02/03/86
  1416.                                                         SYSTEM: KC-TPEGA
  1417.  
  1418.  
  1419.  
  1420.         NAME:
  1421.  
  1422.                 GPCLIP1 -- Clip a point within the current viewport
  1423.  
  1424.         SYNOPSIS:
  1425.  
  1426.                 P: function GPCLIP1(var x,y: Integer): Integer;
  1427.  
  1428.                 C: int GPCLIP1(x,y)
  1429.                      int x,y;
  1430.  
  1431.         DESCRIPTION:
  1432.  
  1433.                 Perform point clipping on the specifed point and return
  1434.             a zero (0) if the point is in the current viewport, else non-
  1435.             zero response.
  1436.  
  1437.         RETURN:
  1438.  
  1439.                 Zero, if inside viewport, else non-zero if outside.
  1440.  
  1441.         EXAMPLE:
  1442.  
  1443.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1444.  
  1445.                void PtAbs(x,y)                  /* Define WORLD routine */
  1446.                  int x,y;
  1447.                {
  1448.                  if (GPCLIP1(x,y) == 0)         /* Do boundary check    */
  1449.                    {
  1450.                    GPSCALE(x,y);                /* If inside viewport
  1451.                    GPPLOT(x,y);                      scale and plot     */
  1452.                    }
  1453.                }
  1454.  
  1455.         SEE ALSO:
  1456.  
  1457.             GPVIEWPORT, GPCLIP2, and GPSCALE.
  1458.  
  1459.  
  1460.                                                         DATE:   02/03/86
  1461.                                                         SYSTEM: KC-TPEGA
  1462.  
  1463.  
  1464.  
  1465.         NAME:
  1466.  
  1467.                 GPCLIP2 -- Clip a line within the current viewport
  1468.  
  1469.         SYNOPSIS:
  1470.  
  1471.                 P: function GPCLIP2(var x1,y1,x2,y2: Integer): Integer;
  1472.  
  1473.                 C: int GPCLIP2(x1,y1,x2,y2)
  1474.                      int *x1,*y1,*x2,*y2;
  1475.  
  1476.         DESCRIPTION:
  1477.  
  1478.                 Perform point clipping on the specifed line and return
  1479.             a zero (0) if the line is completly in the current viewport
  1480.             or an one (1) if line clipping was performed or two (2) if
  1481.             totally outside of the viewport.
  1482.  
  1483.         RETURN:
  1484.  
  1485.                 Returns zero (0) is the line is completly in the viewport
  1486.             (no clipping performed).  One (1) if the line was clip and the
  1487.             x1,y1,x2,y2 value now contain the clipped line.  Two (2) if
  1488.             the line is outside of the viewport.
  1489.  
  1490.         EXAMPLE:
  1491.  
  1492.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1493.  
  1494.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check    */
  1495.                  {
  1496.                  GPSCALE(x1,y1);                /* If inside viewport
  1497.                  GPMOVE(x1,y1);                      scale and draw     */
  1498.                  GPSCALE(x2,y2);
  1499.                  GPLINE(x2,y2);
  1500.                  }
  1501.                }
  1502.  
  1503.         SEE ALSO:
  1504.  
  1505.             GPVIEWPORT, GPCLIP1, and GPSCALE.
  1506.  
  1507.  
  1508.                                                         DATE:   02/03/86
  1509.                                                         SYSTEM: KC-TPEGA
  1510.  
  1511.  
  1512.  
  1513.         NAME:
  1514.  
  1515.                 GPSCALE -- Scale a world coordinate to viewport
  1516.  
  1517.         SYNOPSIS:
  1518.  
  1519.                 P: procedure GPSCALE(var x,y: Integer);
  1520.  
  1521.                 C: void GPSCALE(x,y)
  1522.                      int *x,*y;
  1523.  
  1524.         DESCRIPTION:
  1525.  
  1526.                 Scale the specifed point from world coordinates to the
  1527.             Device coordinates in the current viewport.
  1528.  
  1529.         RETURN:
  1530.  
  1531.                 Changes the X,Y coordinate to real (hardware) coordinates.
  1532.  
  1533.         EXAMPLE:
  1534.  
  1535.             C: GPWINDOW(0,0,1000,1000);         /* Set world coordinates */
  1536.                GPVIEWPORT(50,50,100,100);       /* Set current viewport  */
  1537.  
  1538.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check     */
  1539.                  {
  1540.                  GPSCALE(x1,y1);                /* If insidates f
  1541.                  GPMOVE(x1,y1);                      scale and draw      */
  1542.                  GPSCALE(x2,y2);
  1543.                  GPLINE(x2,y2);
  1544.                  }
  1545.                }
  1546.  
  1547.         SEE ALSO:
  1548.  
  1549.             GPWINDOW, GPVIEWPORT, GPCLIP1, and GPGLIP2.
  1550.  
  1551.  
  1552.                                                         DATE:   02/03/86
  1553.                                                         SYSTEM: KC-TPEGA
  1554.  
  1555.  
  1556.  
  1557.         NAME:
  1558.  
  1559.                 GPFILL -- Fill the specified area with color/shading
  1560.  
  1561.         SYNOPSIS:
  1562.  
  1563.                 P: procedure GPFILL(Border_Color: Integer);
  1564.  
  1565.                 C: void GPFILL(Border_Color)
  1566.                      unsigned integer Border_Color;
  1567.  
  1568.         DESCRIPTION:
  1569.  
  1570.                 Fill in an area starting at the CP to the border given.
  1571.             The current color or current shading will be usee depending
  1572.             on the setting of the GDS_FLG variable.  The routine is for
  1573.             simple areas only, which makes it much faster than GPFLOOD.
  1574.             If the area is too complex for GPFILL, parts of the area will
  1575.             not be filled in (but it will work).  GPFILL will not fill
  1576.             pass the current viewport setting.
  1577.  
  1578.         CAUTIONS:
  1579.  
  1580.             Although any dimension from 1 to 255 can be used, the current
  1581.             version of GPFILL and GPFLOOD only works correctly with shade
  1582.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  1583.             restriction will be removed in the future.
  1584.  
  1585.         EXAMPLE:
  1586.  
  1587.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1588.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1589.  
  1590.                GPSHADE(Shade);             /* Define the shading      */
  1591.  
  1592.                GPMOVE(X1,Y1);
  1593.                GPFILL(color);              /* Flood area with border
  1594.                                               defined by color        */
  1595.  
  1596.         SEE ALSO:
  1597.  
  1598.             GPCOLOR, GPSHADE, GPFLOOD and GPVIEWPORT.
  1599.  
  1600.  
  1601.                                                         DATE:   02/03/86
  1602.                                                         SYSTEM: KC-TPEGA
  1603.  
  1604.  
  1605.  
  1606.         NAME:
  1607.  
  1608.                 GPFLOOD -- Flood the specified area with color/shading
  1609.  
  1610.         SYNOPSIS:
  1611.  
  1612.                 P: procedure GPFLOOD(Border_Color: Integer);
  1613.  
  1614.                 C: void GPFLOOD(Border_Color)
  1615.                      unsigned integer Border_Color;
  1616.  
  1617.         DESCRIPTION:
  1618.  
  1619.                 Flood in an area starting at the CP to the border given.
  1620.             The current color or current shading will be usee depending
  1621.             on the setting of the GDS_FLG variable.  The routine is for
  1622.             all complex areas, which makes it much slower than GPFILL.
  1623.             If the area is simple, try GPFILL, if it does not fill it all
  1624.             then go back to GPFLOOD.  GPFLOOD will not flood pass the
  1625.             current viewport setting.
  1626.  
  1627.         CAUTIONS:
  1628.  
  1629.             Although any dimension from 1 to 255 can be used, the current
  1630.             version of GPFLOOD only works correctly with shade of
  1631.             dimensions of 1,2,4 or 8 (x and y can be different).  This
  1632.             restriction will be removed in the future.
  1633.  
  1634.         EXAMPLE:
  1635.  
  1636.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1637.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1638.  
  1639.                GPSHADE(Shade);             /* Define the shading      */
  1640.  
  1641.                GPMOVE(X1,Y1);
  1642.                GPFLOOD(color);             /* Flood area with border
  1643.                                               defined by color        */
  1644.  
  1645.         SEE ALSO:
  1646.  
  1647.             GPCOLOR, GPSHADE, GPFILL, and GPVIEWPORT.
  1648.  
  1649.  
  1650.